package com.woniuxy.service.impl;

import com.woniuxy.entity.ShopOrders;
import com.woniuxy.mapper.OrderMapper;
import com.woniuxy.service.OrderService;
import com.woniuxy.util.EnhancedSnowFlake;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class oderServiceImpl implements OrderService {

    @Autowired
    OrderMapper orderMapper;
    @Autowired
    private EnhancedSnowFlake snowFlake;


    @Override
    public ShopOrders insertOrderMedical(ShopOrders shopOrders) {
        // 生成uuid
        // 成功后返回订单的信息
        shopOrders.setOrderNumber( snowFlake.nextId());
        System.out.println("order生成的uuid--service"+shopOrders);
        if(orderMapper.insert(shopOrders)>0){
            return shopOrders;
        }
        return null;
    }

    @Override
    public List<ShopOrders> selectByuserIdForUnpay(Integer userId,Integer status,Integer pay_type ) {
        return orderMapper.selectByuserIdForUnpay( userId, status, pay_type );
    }
}
